<template>
	<view class="main">
		<Head></Head>
		<view class="top">
			<view class="top-top">
				模板名称
			</view>
			<view class="top-bottom">
				<view class="top-bottom-oulst" v-for="(item,index) in listOutlt" :key="index"
					@tap="jamp(item.rdn,item.remark,item.orderflag)">
					<view class="top-bottom-oulst-title">
						{{item.remark}}
					</view>
				</view>
			</view>
		</view>
		<view class="bottom">
			<view class="top-top bottom-top">
				评估记录
			</view>
			<view class="bottom-bottom">
				<scroll-view style="height: 100%;" scroll-y="true" :scroll-top="scrollTop" @scroll="scroll">
					<view class="bottome-oulst" v-for="(item,index) in listUnts" :key="index"
						@tap="jamp(item.rdn,item.prtitle,'2')">
						<view class="oulset-title">
							<view class="title-top">
								<text class="text1">{{item.empname}}</text>
								<text class="text2">{{item.InDate}}</text>
							</view>
						</view>
						<view class="box-img"></view>
						<view class="bottom-unit">
							{{item.prtitle}}
						</view>
					</view>
				</scroll-view>
			</view>
		</view>
		<suspension-ball :isShow="false" @tap.native="jampBall"></suspension-ball>
	</view>
</template>

<script>
	import Head from '../../components/html/head.vue'
	import suspensionBall from '../../components/html/xuanfuqiu.vue'
	import {
		PingGuMoBan_list,
		PingGu_list
	} from '../../api/user.js'
	import {
		mapMutations,
		mapState
	} from "vuex";
	export default {
		components: {
			Head,
			suspensionBall
		},
		data() {
			return {
				listOutlt: [],
				listUnts: [],
				scrollTop: 0
			}
		},
		onLoad() {
			this.PingGuMoBan_listFun()
			this.PingGu_listFun()
		},
		watch: {
			deleteObj: {
				// deep: true,
				handler(newval) {
					// this.PingGuMoBan_listFun()
					this.PingGu_listFun()
				},
			}
		},
		computed: {
			...mapState('user', ['userInfo', 'passObj', 'scanningArray', 'deleteObj'])
		},
		methods: {
			jampBall() {
			uni.navigateBack({
				delta: 1, //返回层数，2则上上页
			})
			},
			nav(rdn, name) {
				uni.navigateTo({
					url: '../information/common?id=' + rdn + '&' + 'name=' + name + ''
				});
			},
			jamp(rdn, name, value) {
				
				uni.navigateTo({
					url: '../information/commonmoban?id=' + rdn + '&' + 'name=' + name + '&' + 'value=' + value +
						''
				});
			},
			scroll(e) {
				//记录scroll  位置
				this.oldScrollTop = e.detail.scrollTop
			},
			async PingGuMoBan_listFun() {
				try {
					uni.showLoading({
						title: '加载中...', //显示的文字
						// duration: 3000, //显示多少时间，默认1500毫秒
						icon: "loading", //自定义显示的图标，默认成功success，错误error,加载loading，不显示图标是none
						mask: true
					})
					const user = uni.getStorageSync('userInfo')
					const data = {
						HosKind: user.hoscode,
						sOperdept: user.HosKind,
						sOperJp: user.sPassword
					}
					const res = await this.$http.PingGuMoBan_list(data)
					if (res) {
						this.listOutlt = res
						uni.hideLoading();
					}
				} catch (e) {
					//TODO handle the exception
				}
			},
			async PingGu_listFun() {
				try {
					this.scrollTop = this.oldScrollTop
					//当视图渲染结束 重新设置为0
					this.$nextTick(() => {
						this.scrollTop = 0
					});
					uni.showLoading({
						title: '加载中...', //显示的文字
						// duration: 3000, //显示多少时间，默认1500毫秒
						icon: "loading", //自定义显示的图标，默认成功success，错误error,加载loading，不显示图标是none
						mask: true
					})
					const user = uni.getStorageSync('userInfo')
					const obj = uni.getStorageSync('deleteObj')
					const data = {
						HosKind: user.hoscode,
						iMrn: obj.MRN,
						iSeries: obj.SERIES,
						sOperdept: user.HosKind,
						sOperJp: user.sPassword
					}
					const res = await this.$http.PingGu_list(data)
					if (res) {
						this.listUnts = res
						uni.hideLoading();
					}
				} catch (e) {
					//TODO handle the exception
				}
			}

		}
	}
</script>

<style lang="scss" scoped>
	.main {
		width: 100%;
		height: 100vh;
		background: #F9F9F9;
		overflow-y: hidden;
	}

	.top,
	.bottom {
		width: 100%;
		height: calc((100% - 102px) / 2);
	}

	.top-top {
		height: 46px;
		background: #FF984C;
		font-size: 18px;
		font-family: SourceHanSansCN-Medium, SourceHanSansCN;
		font-weight: 500;
		color: #FFFFFF;
		line-height: 46px;
		text-align: center;
	}

	.top-bottom {
		height: calc(100% - 65px);
		padding: 10px 10px 0;
		overflow-y: scroll;

		.top-bottom-oulst {
			height: 40px;
			background: #FFFFFF;
			box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.06);
			border-radius: 4px;
			display: flex;
			align-items: center;
			padding: 0 20px;
			margin-bottom: 10px;

			&:before {
				content: " ";
				width: 10px;
				height: 10px;
				background: linear-gradient(180deg, #FFC983 0%, #FF984C 100%);
				box-shadow: 0px 0px 2px 0px #CE8956;
				border-radius: 5px;
			}

			.top-bottom-oulst-title {
				font-size: 16px;
				font-family: SourceHanSansCN-Normal, SourceHanSansCN;
				font-weight: 400;
				color: #333333;
				line-height: 24px;
				padding-left: 10px;
			}
		}
	}

	.bottom-top {
		background: #60D170 !important;
	}

	.bottom-bottom {
		height: calc(100% - 65px);
		padding: 10px 10px 0;
		overflow-y: scroll;

		.bottome-oulst {
			// height: 78px;
			background: #E1E4E2;
			border-radius: 6px;
			padding-bottom: 7px;
			position: relative;
			margin-bottom: 10px;

			&:last-child {
				margin-bottom: 0;
			}

			.oulset-title {
				padding: 10px 6px 6px;

				.title-top {
					display: flex;
					align-items: center;
					justify-content: space-between;

					.text1 {
						font-size: 16px;
						font-family: SourceHanSansCN-Medium, SourceHanSansCN;
						font-weight: 500;
						color: #333333;
						line-height: 24px;
						z-index: 2;
					}

					.text2 {
						font-size: 14px;
						font-family: SourceHanSansCN-Medium, SourceHanSansCN;
						font-weight: 500;
						color: #333333;
						z-index: 2;
						line-height: 21px
					}
				}
			}

		}

		.bottom-unit {
			background: #F7F7F7;
			border-radius: 6px;
			opacity: 0.95;
			padding: 10px;
			margin: 0 6px;
			font-size: 16px;
			font-family: SourceHanSansCN-Medium, SourceHanSansCN;
			font-weight: 500;
			color: #333333;
			line-height: 24px;
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
		}

		.box-img {
			position: absolute;
			right: 0;
			top: 0;
			width: 176px;
			height: 36px;
			background: url('../../static/img/xingzhuang.svg') no-repeat;
			background-size: 100% auto;
			// box-shadow: 3px -1px 8px 0px #D4D9D9;
		}
	}
</style>
